<template>
    <section class="padding"> 
		<el-row>
			<mdp-select-cate v-model="filters.categoryId" placeholder="分类"></mdp-select-cate>
			<mdp-select v-if="!archiveType" v-model="filters.categoryType"  placeholder="主题" clearable item-code="categoryType"  width="100px"/>  
			<mdp-select-tag v-model="filters.tagIds" placeholder="标签"/>
			<mdp-select  placeholder="状态" clearable v-model="filters.status"  item-code="archiveStatus" width="100px"/>  
			<el-input v-model="filters.id" style="width: 12%;" placeholder="编号查询 输入 *字符* >10 <9 等" clearable title="支持>、<、 >=、<=、!=、*字符*、$IS NULL、$IN 1,2,3、$between 1,5等操作符"/>
			<el-input v-model="filters.archiveAbstract" style="width: 12%;" placeholder="摘要查询 输入 *字符* >10 <9 等" clearable title="支持>、<、 >=、<=、!=、*字符*、$IS NULL、$IN 1,2,3、$between 1,5等操作符"/>
			<el-input v-model="filters.archiveTitle" style="width: 12%;" placeholder="标题查询 输入 *字符* >10 <9 等" clearable title="支持>、<、 >=、<=、!=、*字符*、$IS NULL、$IN 1,2,3、$between 1,5等操作符"/>
			
			<el-button v-loading="load.list" :disabled="load.list==true" @click="searchTableDatas()" icon="el-icon-search" type="primary">查询</el-button>

			<span style="float:right;" v-if="currOpType=='mng'">
				<el-button :disabled="disabledJudge('addBtn') || !checkBtnQx('addBtn',menuDefId) " type="primary" @click="openForm({parentOpType:currOpType,subOpType:'add',formData:addForm,title:'新增'})" icon="el-icon-plus"/>
				<el-button :disabled="disabledJudge('delBtn') || !checkBtnQx('delBtn',menuDefId) || this.sels.length===0 || load.del==true" type="danger" v-loading="load.del" @click="batchDel" icon="el-icon-delete"/>
			</span>
			<span style="float:right;" v-else-if="currOpType=='select' &&  this.multiple==true">
				<el-button :disabled="disabledJudge('selectBtn') || this.sels.length===0" type="primary" @click="selectListConfirm" icon="el-icon-check"/>
			</span>
		</el-row>
		<el-row> 
					<mdp-hi-query :column-configs="columnConfigs" v-model="hiQueryParams" @change="onHiQueryParamsChange"/>
					<el-button type="text" icon="el-icon-zoom-out" @click="searchReset()">重置查询</el-button>&nbsp;&nbsp;&nbsp;
					<el-button  type="text" v-loading="load.unPublish"  @click="unPublishArchive" :disabled="this.sels.length===0" icon="el-icon-download">下架</el-button>
 
		</el-row>
		<el-row>
			<!--列表 Archive 档案信息表-->
			<el-table :ref="refId+'Table'" :height="100" v-adaptive="{bottomOffset: bottomOffset}" :data="tableDatas" @sort-change="sortChange" highlight-current-row v-loading="load.list" border @selection-change="selsChange" @row-click="rowClick" style="width: 100%;">
				<el-table-column  type="selection" width="55" show-overflow-tooltip fixed="left" v-if="currOpType=='mng' || this.multiple==true"></el-table-column>
				<el-table-column prop="id" label="编号" min-width="120" show-overflow-tooltip  fixed="left" col-type="String" v-if="showCol('id')"></el-table-column>
				
				<el-table-column prop="archiveTitle"  label="标题" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('archiveTitle')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.archiveTitle" :maxlength="200" @change="editSomeFields(editForm,'archiveTitle',$event)" :disabled="disabledJudge('archiveTitle')||true"/>
					</template>
				</el-table-column>
				<el-table-column prop="tagIds"  label="标签" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('archiveTitle')">
					<template slot-scope="scope">
							<mdp-select-tag :multiple="true" show-style="tag" v-model="scope.row.tagIds" split="," :maxlength="200" @change2="editSomeFields(editForm,'tagIds',$event)" :disabled="disabledJudge('tagIds')"/>
					</template>
				</el-table-column>
				<el-table-column prop="createDate"  label="创建日期" min-width="120" show-overflow-tooltip col-type="Date" v-if="showCol('createDate')">
					<template slot-scope="scope">
							<mdp-date type="date" placeholder="选择日期" show-style="tag" v-model="scope.row.createDate"  value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd" :disabled="disabledJudge('createDate')||true"/>
					</template>
				</el-table-column>
				<el-table-column prop="authorName"  label="作者名称" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('authorName')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.authorName" :maxlength="50" @change="editSomeFields(editForm,'authorName',$event)" :disabled="disabledJudge('authorName')||true"/>
					</template>
				</el-table-column>
				<el-table-column prop="canComment"  label="开放评论" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('canComment')">
					<template slot-scope="scope">
						<el-switch
							v-model="scope.row.canComment" active-value="1" inactive-value="0" @change="editSomeFields(scope.row,'canComment',$event)" :disabled="disabledJudge('canComment')">
						</el-switch>
					</template>
				</el-table-column>

				<el-table-column prop="status"  label="状态" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('status')">
					<template slot-scope="scope">
							<mdp-select show-style="tag" item-code="archiveStatus" v-model="scope.row.status" :maxlength="1" @change="editSomeFields(editForm,'status',$event)" :disabled="disabledJudge('status')||true"/>
					</template>
				</el-table-column>
				<el-table-column prop="isHot"  label="火热" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('isHot')">
					<template slot-scope="scope"> 
						<el-switch
							v-model="scope.row.isHot" active-value="1" inactive-value="0" @change="editSomeFields(scope.row,'isHot',$event)" :disabled="disabledJudge('isHot')">
						</el-switch>
					</template>
				</el-table-column>
				<el-table-column prop="isMain"  label="推荐" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('isMain')">
					<template slot-scope="scope"> 
						<el-switch
							v-model="scope.row.isMain" active-value="1" inactive-value="0" @change="editSomeFields(scope.row,'isMain',$event)" :disabled="disabledJudge('isMain')">
						</el-switch>								
					</template>
				</el-table-column>
				
				<el-table-column prop="readNums"  label="阅读人数" min-width="120" show-overflow-tooltip col-type="Integer" v-if="showCol('readNums')">
					<template slot-scope="scope">
							<mdp-number show-style="tag" v-model="scope.row.readNums" :precision="0" :disabled="disabledJudge('readNums')||true"/>
					</template>
				</el-table-column>
				<el-table-column prop="commentNums"  label="评论人数" min-width="120" show-overflow-tooltip col-type="Integer" v-if="showCol('commentNums')">
					<template slot-scope="scope">
							<mdp-number show-style="tag" v-model="scope.row.commentNums" :precision="0" :disabled="disabledJudge('commentNums')||true"/>
					</template>
				</el-table-column>
				<el-table-column prop="praiseSum"  label="点赞的次数" min-width="120" show-overflow-tooltip col-type="BigDecimal" v-if="showCol('praiseSum')||true">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.praiseSum" :maxlength="10" :disabled="disabledJudge('praiseSum')||true"/>
					</template>
				</el-table-column>
				<el-table-column prop="branchId"  label="机构编号" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('branchId')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.branchId" :maxlength="50" @change="editSomeFields(editForm,'branchId',$event)" :disabled="disabledJudge('branchId')||true"/>
					</template>
				</el-table-column>
				
				<el-table-column prop="archivingDate"  label="归档日期" min-width="120" show-overflow-tooltip col-type="Date" v-if="showCol('archivingDate')">
					<template slot-scope="scope">
							<mdp-date type="date" placeholder="选择日期" show-style="tag" v-model="scope.row.archivingDate"  value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd" :disabled="disabledJudge('archivingDate')||true"/>
					</template>
				</el-table-column>
				<el-table-column prop="authorUserid"  label="作者编号" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('authorUserid')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.authorUserid" :maxlength="50" @change="editSomeFields(editForm,'authorUserid',$event)" :disabled="disabledJudge('authorUserid')||true"/>
					</template>
				</el-table-column>
				<el-table-column prop="canDel"  label="是否可删除" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('canDel')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.canDel" :maxlength="1" @change="editSomeFields(editForm,'canDel',$event)" :disabled="disabledJudge('canDel')"/>
					</template>
				</el-table-column>
				<el-table-column prop="canEdit"  label="是否可修改" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('canEdit')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.canEdit" :maxlength="1" @change="editSomeFields(editForm,'canEdit',$event)" :disabled="disabledJudge('canEdit')"/>
					</template>
				</el-table-column>
				<el-table-column prop="canRead"  label="是否可读" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('canRead')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.canRead" :maxlength="1" @change="editSomeFields(editForm,'canRead',$event)" :disabled="disabledJudge('canRead')"/>
					</template>
				</el-table-column>
				<el-table-column prop="archivingUserid"  label="归档人" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('archivingUserid')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.archivingUserid" :maxlength="50" @change="editSomeFields(editForm,'archivingUserid',$event)" :disabled="disabledJudge('archivingUserid')||true"/>
					</template>
				</el-table-column>
				<el-table-column prop="isFromArchiving"  label="是否来自归档" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('isFromArchiving')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.isFromArchiving" :maxlength="1" @change="editSomeFields(editForm,'isFromArchiving',$event)" :disabled="disabledJudge('isFromArchiving')||true"/>
					</template>
				</el-table-column> 
				<el-table-column prop="archiveAbstract"  label="摘要" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('archiveAbstract')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.archiveAbstract" :maxlength="1000" @change="editSomeFields(editForm,'archiveAbstract',$event)" :disabled="disabledJudge('archiveAbstract')"/>
					</template>
				</el-table-column>
				<el-table-column prop="titleImgUrl"  label="标题图片链接" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('titleImgUrl')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.titleImgUrl" :maxlength="150" @change="editSomeFields(editForm,'titleImgUrl',$event)" :disabled="disabledJudge('titleImgUrl')"/>
					</template>
				</el-table-column>
				<el-table-column prop="type"  label="类型" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('type')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.type" :maxlength="10" @change="editSomeFields(editForm,'type',$event)" :disabled="disabledJudge('type')"/>
					</template>
				</el-table-column>
				<el-table-column prop="duration"  label="时长" min-width="120" show-overflow-tooltip col-type="Integer" v-if="showCol('duration')">
					<template slot-scope="scope">
							<mdp-number show-style="tag" v-model="scope.row.duration" :precision="0" :disabled="disabledJudge('duration')"/>
					</template>
				</el-table-column>
				<el-table-column prop="archiveType"  label="主题" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('archiveType')">
					<template slot-scope="scope"> 
							<mdp-select show-style="tag" v-model="scope.row.archiveType" item-code="categoryType" :maxlength="1" @change="editSomeFields(editForm,'archiveType',$event)" :disabled="disabledJudge('archiveType')"/>
					</template>
				</el-table-column>
				<el-table-column prop="imageUrls"  label="图文说明" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('imageUrls')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.imageUrls" :maxlength="65535" @change="editSomeFields(editForm,'imageUrls',$event)" :disabled="disabledJudge('imageUrls')"/>
					</template>
				</el-table-column>
				<el-table-column prop="linkArchives"  label="关联文章列表" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('linkArchives')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.linkArchives" :maxlength="65535" @change="editSomeFields(editForm,'linkArchives',$event)" :disabled="disabledJudge('linkArchives')"/>
					</template>
				</el-table-column>
				
				<el-table-column prop="bizKey"  label="业务编号" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('bizKey')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.bizKey" :maxlength="50" @change="editSomeFields(editForm,'bizKey',$event)" :disabled="disabledJudge('bizKey')"/>
					</template>
				</el-table-column>
				<el-table-column prop="encryptType"  label="加密方式" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('encryptType')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.encryptType" :maxlength="1" @change="editSomeFields(editForm,'encryptType',$event)" :disabled="disabledJudge('encryptType')"/>
					</template>
				</el-table-column>
				<el-table-column prop="isStorageDir"  label="存硬盘" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('isStorageDir')">
					<template slot-scope="scope"> 
						<el-switch
							v-model="scope.row.isStorageDir" active-value="1" inactive-value="0" @change="editSomeFields(scope.row,'isStorageDir',$event)" :disabled="disabledJudge('isStorageDir')">
						</el-switch>								</template>
				</el-table-column>
				<el-table-column prop="linkAds"  label="关联广告" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('linkAds')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.linkAds" :maxlength="65535" @change="editSomeFields(editForm,'linkAds',$event)" :disabled="disabledJudge('linkAds')"/>
					</template>
				</el-table-column>
				<el-table-column prop="linkUsers"  label="关联用户" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('linkUsers')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.linkUsers" :maxlength="65535" @change="editSomeFields(editForm,'linkUsers',$event)" :disabled="disabledJudge('linkUsers')"/>
					</template>
				</el-table-column>
				<el-table-column prop="extInfos"  label="扩展字段" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('extInfos')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.extInfos" :maxlength="65535" @change="editSomeFields(editForm,'extInfos',$event)" :disabled="disabledJudge('extInfos')"/>
					</template>
				</el-table-column>
				<el-table-column prop="opDate"  label="最后更新日期" min-width="120" show-overflow-tooltip col-type="Date" v-if="showCol('opDate')">
					<template slot-scope="scope">
							<mdp-date type="date" placeholder="选择日期" show-style="tag" v-model="scope.row.opDate"  value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd" :disabled="disabledJudge('opDate')"/>
					</template>
				</el-table-column>
				<el-table-column prop="seqNo"  label="排序" min-width="120" show-overflow-tooltip col-type="Integer" v-if="showCol('seqNo')">
					<template slot-scope="scope">
							<mdp-number show-style="tag" v-model="scope.row.seqNo" :precision="0" :disabled="disabledJudge('seqNo')"/>
					</template>
				</el-table-column>
				<el-table-column prop="ctime"  label="创建日期" min-width="120" show-overflow-tooltip col-type="Date" v-if="showCol('ctime')">
					<template slot-scope="scope">
							<mdp-date type="date" placeholder="选择日期" show-style="tag" v-model="scope.row.ctime"  value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd" :disabled="disabledJudge('ctime')"/>
					</template>
				</el-table-column>
				<el-table-column prop="ip"  label="ip地址" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('ip')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.ip" :maxlength="50" @change="editSomeFields(editForm,'ip',$event)" :disabled="disabledJudge('ip')"/>
					</template>
				</el-table-column>
				<el-table-column prop="cityId"  label="城市编号" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('cityId')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.cityId" :maxlength="50" @change="editSomeFields(editForm,'cityId',$event)" :disabled="disabledJudge('cityId')"/>
					</template>
				</el-table-column>
				<el-table-column prop="cityName"  label="城市名称" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('cityName')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.cityName" :maxlength="50" @change="editSomeFields(editForm,'cityName',$event)" :disabled="disabledJudge('cityName')"/>
					</template>
				</el-table-column>
				<el-table-column prop="upNums"  label="点赞数" min-width="120" show-overflow-tooltip col-type="Integer" v-if="showCol('upNums')">
					<template slot-scope="scope">
							<mdp-number show-style="tag" v-model="scope.row.upNums" :precision="0" :disabled="disabledJudge('upNums')"/>
					</template>
				</el-table-column>
				<el-table-column prop="collectNums"  label="收藏数" min-width="120" show-overflow-tooltip col-type="Integer" v-if="showCol('collectNums')">
					<template slot-scope="scope">
							<mdp-number show-style="tag" v-model="scope.row.collectNums" :precision="0" :disabled="disabledJudge('collectNums')"/>
					</template>
				</el-table-column>
				<el-table-column prop="tagNames"  label="标签名多个,分割" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('tagNames')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.tagNames" :maxlength="100" @change="editSomeFields(editForm,'tagNames',$event)" :disabled="disabledJudge('tagNames')"/>
					</template>
				</el-table-column>
				<el-table-column prop="deptid"  label="创建部门" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('deptid')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.deptid" :maxlength="100" @change="editSomeFields(editForm,'deptid',$event)" :disabled="disabledJudge('deptid')"/>
					</template>
				</el-table-column>
				<el-table-column prop="userid"  label="创建人" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('userid')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.userid" :maxlength="100" @change="editSomeFields(editForm,'userid',$event)" :disabled="disabledJudge('userid')"/>
					</template>
				</el-table-column>
				<el-table-column prop="isShare"  label="是否共享" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('isShare')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.isShare" :maxlength="1" @change="editSomeFields(editForm,'isShare',$event)" :disabled="disabledJudge('isShare')"/>
					</template>
				</el-table-column>
				<el-table-column prop="url"  label="访问路径" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('url')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.url" :maxlength="150" @change="editSomeFields(editForm,'url',$event)" :disabled="disabledJudge('url')"/>
					</template>
				</el-table-column> 
				<el-table-column prop="tagIds"  label="标签编号列表,逗号分隔" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('tagIds')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.tagIds" :maxlength="255" @change="editSomeFields(editForm,'tagIds',$event)" :disabled="disabledJudge('tagIds')"/>
					</template>
				</el-table-column>
				
				<el-table-column prop="relyTypes"  label="参考类型" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('relyTypes')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.relyTypes" :maxlength="255" @change="editSomeFields(editForm,'relyTypes',$event)" :disabled="disabledJudge('relyTypes')"/>
					</template>
				</el-table-column>
				<el-table-column prop="relyIds"  label="参考编号,逗号" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('relyIds')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.relyIds" :maxlength="255" @change="editSomeFields(editForm,'relyIds',$event)" :disabled="disabledJudge('relyIds')"/>
					</template>
				</el-table-column>
				<el-table-column prop="relySubTypes"  label="参考子类型,逗号" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('relySubTypes')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.relySubTypes" :maxlength="255" @change="editSomeFields(editForm,'relySubTypes',$event)" :disabled="disabledJudge('relySubTypes')"/>
					</template>
				</el-table-column>
				<el-table-column prop="relySubIds"  label="参考子编号,逗号" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('relySubIds')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.relySubIds" :maxlength="255" @change="editSomeFields(editForm,'relySubIds',$event)" :disabled="disabledJudge('relySubIds')"/>
					</template>
				</el-table-column>
				
				<el-table-column prop="archiveContext"  label="内容" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('archiveContext')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.archiveContext" :maxlength="65535" @change="editSomeFields(editForm,'archiveContext',$event)" :disabled="disabledJudge('archiveContext')"/>
					</template>
				</el-table-column>
				<el-table-column prop="pbizKey"  label="上级业务编号" min-width="120" show-overflow-tooltip col-type="String" v-if="showCol('pbizKey')">
					<template slot-scope="scope">
							<mdp-input show-style="tag" v-model="scope.row.pbizKey" :maxlength="50" @change="editSomeFields(editForm,'pbizKey',$event)" :disabled="disabledJudge('pbizKey')"/>
					</template>
				</el-table-column>
				<el-table-column label="操作" :width="currOpType=='mng'?380:180" fixed="right">
					<template slot="header" slot-scope="scope">
						<el-button icon="el-icon-download" @click="export2Excel()">导出</el-button>
						<mdp-table-configs :column-configs="columnConfigs" v-model="checkedColumns"/>
					</template>
					<template scope="scope" v-if="currOpType=='mng'"  >
						<el-button :disabled="disabledJudge('editBtn') || !checkBtnQx('editBtn',menuDefId) " type="primary" @click="openForm({parentOpType:currOpType,subOpType:'edit',formData:scope.row,title:'修改'})" icon="el-icon-edit" title="修改一条数据"/>
						<el-button :disabled="disabledJudge('addBtn') || !checkBtnQx('addBtn',menuDefId) " type="success" @click="copy(scope.row)" icon="el-icon-document-copy" title="拷贝并新增一条除了编号不一样其它都一样的数据"/>
						<el-button :disabled="disabledJudge('delBtn') || !checkBtnQx('delBtn',menuDefId) " type="danger" @click="handleDel(scope.row,scope.$index)" icon="el-icon-delete"  title="删除一条数据"/>
						
						<el-button type="text" @click="showDetail( scope.row,scope.$index)">预览</el-button>
						<el-button type="primary" v-if="scope.row.status!='1'"  @click="publishArchive(scope.row,scope.$index)" icon="el-icon-upload">上架</el-button> 
						<el-button type="warning" v-if="scope.row.status=='1'"  @click="unPublishOneArchive(scope.row,scope.$index)" icon="el-icon-download">下架</el-button> 
						<el-button class="copyBtn" :data-clipboard-text = "arcBasePath+'/arc/archive/showArchive?id='+scope.row.id" type="text">复制地址</el-button>
					</template>

					<template scope="scope" v-else-if="currOpType=='list'" >
						<el-button   type="primary" @click="openForm({parentOpType:currOpType,subOpType:'detail',formData:scope.row})" icon="el-icon-view"/>
					</template>

					<template scope="scope" v-else-if="currOpType=='select' && this.multiple!=true" >
						<el-button   type="primary" @click="selectConfirm(scope.row)" icon="el-icon-check"/>
					</template>
				</el-table-column>
			</el-table>
		</el-row>
		<el-row>
			<el-pagination
				layout="slot,total, sizes, prev, next,pager,jumper"
				@current-change="handleCurrentChange"
				@size-change="handleSizeChange"
				:page-sizes="[10,20, 50, 100, 500]"
				:current-page="pageInfo.pageNum"
				:page-size="pageInfo.pageSize"
				:total="pageInfo.total"
				style="float:right;"
			> 
			</el-pagination>
		</el-row>
		<el-row>
			<!--新增修改明细 Archive 档案信息表界面-->
			<mdp-dialog :ref="refId+'FormDialog'" fullscreen>
				<template v-slot="{visible,data,dialog}">
					<archive-form :ref="refId+'Form'" :visible="visible" :parent-op-type="currOpType" :sub-op-type="data.subOpType" :form-data="data.formData" @close="onFormClose" @submit="afterFormSubmit" @fields-change="afterEditSomeFields"/>
				</template>
			</mdp-dialog>
		</el-row> 
		<!--预览Archive 档案信息表界面-->
		<mdp-dialog ref="archiveDetailDialog" title="预览文章" fullscreen    :close-on-click-modal="false">
			<template v-slot="{visible,data,dialog}">
				<archive-detail :archive="data.formData"  :archive-type="archiveType" :visible="visible" @cancel="dialog.close()"></archive-detail>
			</template>
		</mdp-dialog> 
		
					<!--预览Archive 档案信息表界面-->
		<mdp-dialog ref="publishDialog" title="发布文章" :modal="false" :close-on-click-modal="false" append-to-body>
			<template v-slot="{visible,data,dialog}">
				<archive-category-transfer :visible="visible" :archive-id="data.id" :archive-type="data.archiveType" :archive-title="data.archiveTitle" @publish-success="onPublishSuccess" ></archive-category-transfer>
			</template>	
		</mdp-dialog>
		
		<mdp-dialog ref="tagDialog"  title="标签条件"   width="70%"> 
			<template v-slot="{visible,data,dialog}"> 
				<tag-mng :tagIds="filters.tagIds?filters.tagIds:[]"  :jump="true" @select-confirm="onTagSelected"></tag-mng> 
			</template>
		</mdp-dialog> 
	</section>
</template>

<script>

 import { MdpTableMixin } from '@/components/mdp-ui/mixin/MdpTableMixin.js';
import * as ArchiveApi from '@/api/mdp/arc/archive/archive';
import  ArchiveForm from './Form';//新增修改明细界面

import  ArchiveDetail from './Detail';//修改界面  
import config from '@/common/config';//全局公共库

import Clipboard from 'clipboard'
import { mapGetters } from 'vuex'

export default {
    name:'archiveMng',
	props:{
		archiveType:String,
	},
    mixins:[MdpTableMixin],
    components: {
        ArchiveForm,ArchiveDetail
    },
    computed: {
    },
    watch:{
    },
    data() {
        return {
            menuDefId:'',//menu_def.id 菜单表菜单编号，用于按钮权限判断
            menuDefName:'档案信息表',//menu_def.name 功能名称，用于导出excel等文件名
            refId:'archive',//引用编号，<table :ref="refId+'Table'"> <form :ref="refId+'Form'">
            pkNames:["id"],//表格编号的java属性名称，驼峰命名，默认为id,支持多编号
            currOpType:'mng',//表格 mng-综合管理具有最大权限，所有按钮可动、detail-只看不能操作
            filters:{//查询参数

            },
            defaultFilters:{//默认查询参数,第一次打开界面的时候用到，恢复默认值的时候用到

            },

            defaultCheckColumnNum:15,//默认展示的表格列数，前8列

            //增删改查(含批量)接口
            apis:{
                list: ArchiveApi.listArchive,
                add: ArchiveApi.addArchive,
                del: ArchiveApi.delArchive,
                edit: ArchiveApi.editArchive,
                editSomeFields: ArchiveApi.editSomeFieldsArchive,
                batchAdd: ArchiveApi.batchAddArchive,
                batchDel: ArchiveApi.batchDelArchive,
                batchEdit: ArchiveApi.batchEditArchive,
            },
			
			arcBasePath: config.getArcImagePath(),
        }
    },
    methods: { 
         //页面初始化需要配置的特殊逻辑写这里
          initCurrData(){
             this.searchTableDatas();
          },

          /**
           * 检查参数是否满足调用后台接口的条件
           *
           * @param params 提交给后台的参数池,map类型
           * @returns true / false
           */
          preQueryParamCheck(params){
			params.archiveType=this.archiveType
              return true;
          },

          //页面数据加载完后需要对数据进行加工处理的
          afterList(res,isOk,apiName){

          },

          /**
           * 对修改的字段进行判断，返回false ,将取消更新数据库
           * @param {*} row 当前选中的行
           * @param {*} fieldName 修改的字段名
           * @param {*} $event 修改后的值
           * @param {*} params 将要提交服务器的参数
           * @returns true/false 返回false ,将取消更新数据库
           */
          editSomeFieldsCheck(row,fieldName,$event,params){
              if(this.currOpType=='add'||this.currOpType=='detail'){
                  return false;
              }
			  if(fieldName=='tagIds'){
				if($event && $event.length>0){
					params['tagIds']=$event.map(k=>k.tagId).join(",") 
					params['tagNames']=$event.map(k=>k.tagName).join(",")
				}else{ 
					params['tagIds']='' 
					params['tagNames']=''
				}
				return true;
			  }
              params[fieldName]=$event
              return true;
          },
           /**
           * 设置某个关键词、按钮、输入框禁用 disabledRules['addBtn']=false
           * 判断某个对象是否可编辑 this.disabledJudge('addBtn')==false
           */
          disabledRulesInit(disabledRules){

          },
         /**
          * 打开某个子页面
          */
        openForm(res){
            let {parentOpType,formRefId,subOpType,formData} = res
            if(!formRefId){
                formRefId=this.getRefId()+"FormDialog"
            }
            if(!parentOpType){
                parentOpType=this.currOpType
            }
            var form=this.$refs[formRefId]
            if(form){
                res.parentOpType=parentOpType
                res.formRefId=formRefId
				res.formData={...formData}
                form.open(res);
            }else{

            }

        },
		
		unPublishArchive: function(){
			this.load.unPublish=true
			let ids=this.sels.map(i=>i.id)
			ArchiveApi.unPublish(ids).then(res=>{
				this.load.unPublish=false
				this.searchTableDatas()
				
			});
		},
		handleCategoryCheckChange(data, checked, indeterminate){ 
			this.tableDatas=[]
			if(data.id=='C0' || checked==false){//选择了根节点，默认不按分类查询
				this.filters.categoryId=null 
			}else{
				this.filters.categoryId=data.id;  
			} 
			this.searchTableDatas();
		},
		showDetail: function ( row,index ) { 
			let routerJump = this.$router.resolve({ path: '/mdp/arc/mate/archive/ArchiveDetail/'+row.id});
			window.open(routerJump.href, '_blank');  
		}, 
		onPublishSuccess(){ 
			this.$refs['publishDialog'].close();
			this.searchTableDatas();
		},
		publishArchive: function(row,index){ 
			if(row.status == '3'){
				this.$message.error('文章正在审核中，不能操作');
				return;
			} 
			this.$refs['publishDialog'].open({...row})
		}, 
		unPublishArchive: function(){
			this.load.unPublish=true
			let ids=this.sels.map(i=>i.id)
			ArchiveApi.unPublish(ids).then(res=>{
				this.load.unPublish=false
				this.searchTableDatas()
				
			});
		},
		unPublishOneArchive(row){
			ArchiveApi.unPublish([row.id]).then(res=>{
				if(res.data.tips.isOk){
					this.$message.success('下架成功'); 
					this.load.unPublish=false
					this.searchTableDatas()
				}else{
					this.$message.error(res.data.tips.msg);
				} 
				
			});
		},
		copyArchiveUrl(row,index){
			var clipBoardContent=config.getArcBasePath()+"/arc/archive/showArchive?id="+row.id;
			window.clipboardData.setData("Text",clipBoardContent);
		},
		onTagSelected(tags){

		}
    },
    mounted() { 
		let clipboard = new Clipboard('.copyBtn'); 
    }
}

</script>

<style scoped>
</style>